﻿using Core.Authorization;
using Microsoft.AspNetCore.Builder;

namespace Infrastructure.Auth.Policy;

public static class EndpointExtensions
{
    public static RouteHandlerBuilder RequirePermission(
        this RouteHandlerBuilder builder,
        string permission)
    {
        return builder.WithMetadata(new PermissionAttribute(permission));
    }
}
